/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import org.junit.After
import org.junit.AfterClass
import org.junit.Before
import org.junit.BeforeClass
import org.junit.Test
import static org.junit.Assert.*

import inc.veluvana.weatherforecaster.Order
import inc.veluvana.weatherforecaster.OrderLoader
import inc.veluvana.weatherforecaster.Hardwood
import inc.veluvana.weatherforecaster.*

/**
 *
 * @author victor
 */
class testOrderLoader {

    public testOrderLoader() {
    }

    @BeforeClass
    public static void setUpClass() {
    }

    @AfterClass
    public static void tearDownClass() {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }
    // TODO add test methods here.
    // The methods must be annotated with annotation @Test. For example:
    //
     @Test
     public void testLoadFile() {
       
        //load File not null
        def input=new File("/home/victor/testfile.txt")
        Order or=OrderLoader.load(input)
        assert or!=null
     }
     @Test
     public void testReadFile(){
           //create a object Order with same information that file
         Order o=new Order();
         o.setBuyerName("Pepito Perez")
         o.setDeliveryAddress("Fake Street 123")
         o.setAmount(Hardwood.CHERRY,100)
         o.setAmount(Hardwood.WHITE_OAK,50)
         o.setAmount(Hardwood.CURLY_MAPLE,20)
         o.setAmount(Hardwood.WENGE,80)
         
        def input=new File("/home/victor/testfile.txt")
        Order or=OrderLoader.load(input)
        assert or.getBuyerName()==o.getBuyerName()
        assert or.getDeliveryAddress()==o.getDeliveryAddress()
        
     }
     
}
